-
-
Notifications
You must be signed in to change notification settings - Fork 147
fix query params sorting to build correct canonical query string #1938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix query params sorting to build correct canonical query string #1938
Conversation
87c2dd2 to
b0154ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the investigation end the psycho pull request.
could you please provide a test for this ?
|
@jderusse |
uh.. my keyboard replaced pull reaquest by psycho 😅 |
|
@jderusse |
|
thank you @DmytroVyshnevsky1 |
Hello!
I found a bug while working with Async AWS , AWS sdk have the same one.
If one of the query params is an array with 10+ elements it causes an error:
"The request signature we calculated does not match the signature you provided".
The root of problem is sorting of query params for canonical string, cause params should be sorted by name AFTER url encoding.
You can read about this here
quote:
" You must also sort the parameters in the canonical query string alphabetically by key name. The sorting occurs after encoding."
This ksort is the reason of problem.
Example URL:
The example of sorting result on current version:
and the correct one after this fix:
As you can see current sorting put 10 and 1 in wrong places. This not allowed signer to build correct canonical query string.
Also need to clarify that Query parameters are added to the request via: